[pull] main from MetaMask:main#414
Merged
Merged
Conversation
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Removed hardcoded mainnet target when converting mUSD. ### Changes - Attempt to convert to mUSD on the same network as the payment token. If mUSD isn't deployed on the payment token's network we fallback to mainnet. - Cleaned up repeated `hasSeenEducationalScreen` logic and centralized into `initiateConversion`. This way callers don't need to worry about handling educational screen redirects - Fixed bug where mUSD conversion CTA on Asset Overview page wasn't being rendered for BSC. <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: removed hardcoded mainnet output chainId for mUSD conversion flow ## **Related issues** Fixes: [MUSD-106: Support Linea to Linea conversions](https://consensyssoftware.atlassian.net/browse/MUSD-106) ## **Manual testing steps** ```gherkin Feature: mUSD Conversion Flow Scenario: User enters mUSD conversion from Asset List CTA with automatic token selection Given user has one or more supported stablecoins in their wallet When user taps "Get mUSD" button on the Asset List CTA Then the supported stablecoin with the highest balance is automatically selected as the payment token And mUSD conversion flow is initiated Scenario: mUSD conversion targets same network as payment token when supported Given user initiates mUSD conversion with a payment token And the payment token is on a network where mUSD is deployed When the conversion flow determines the target mUSD chain Then target mUSD is on the same network as the payment token Scenario: mUSD conversion falls back to Ethereum mainnet when payment token network is unsupported Given user initiates mUSD conversion with a payment token And the payment token is on a network where mUSD is NOT deployed When the conversion flow determines the target mUSD chain Then target mUSD falls back to Ethereum mainnet ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> mUSD conversion flow was hardcoded to convert to mainnet mUSD. ### **After** <!-- [screenshots/recordings] --> Linea -> Linea swap demo - [link](https://www.loom.com/share/928fbe718c8844f2922498f76b529562) ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Routes mUSD conversion to the payment token’s supported chain (fallback to mainnet) and centralizes the education-screen redirect in `initiateConversion`, updating CTAs and Earn views accordingly. > > - **mUSD Conversion Flow** > - Use `useMusdConversionTokens.getMusdOutputChainId` to target the payment token’s chain when supported; fallback to `MUSD_CONVERSION_DEFAULT_CHAIN_ID`. > - Centralize education handling in `useMusdConversion` with `skipEducationCheck` and `handleEducationRedirectIfNeeded`; callers no longer navigate to education directly. > - Remove Relay-specific `nestedTransactions`; keep immediate navigation to redesigned confirmations. > - **UI Updates** > - `MusdConversionAssetListCta`, `MusdConversionAssetOverviewCta`, `StakeButton` now use `getMusdOutputChainId`; drop local education logic; normalize addresses (checksum where needed). > - `EarnLendingBalance`: render mUSD conversion CTA when lending is disabled; prefer it over lending empty state; refactor CTA rendering. > - `EarnBalance`: treat mUSD-convertible stablecoins as Earn items (route to `EarnLendingBalance`). > - **Hooks/Utils** > - `useMusdConversionTokens`: add `isMusdSupportedOnChain` (optional param) and new `getMusdOutputChainId`. > - **Tests** > - Update/expand tests across views/components/hooks to reflect new chain targeting, education flow, and CTA behavior. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 4c0aa76. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->
## **Description**
> Pre-sets flags during automated vault initialization to bypass
multichain intro, predictions GTM, and notifications prompts.
>
> - **Onboarding initialization
(`app/util/generateSkipOnboardingState.ts`)**:
> - Dispatches `setMultichainAccountsIntroModalSeen(true)` to bypass the
multichain accounts intro.
> - Pre-sets storage flags to bypass modals:
> - `PREDICT_GTM_MODAL_SHOWN` → `TRUE` (skip predictions GTM modal)
> - `HAS_USER_TURNED_OFF_ONCE_NOTIFICATIONS` → `TRUE` (suppress enable
notifications prompt)
>
## **Changelog**
<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`
If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`
(This helps the Release Engineer do their job more quickly and
accurately)
-->
CHANGELOG entry:
## **Related issues**
Fixes:
## **Manual testing steps**
```gherkin
Feature: my feature name
Scenario: user [verb for user action]
Given [describe expected initial app state]
When user [verb for user action]
Then [describe expected outcome]
```
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
https://github.com/user-attachments/assets/a31dd429-b8b9-43da-843a-bd14c46b38fe
### **After**
https://github.com/user-attachments/assets/03c0c605-bcfd-4046-9319-9a6405304af9
## **Pre-merge author checklist**
- [ ] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
## **Pre-merge reviewer checklist**
- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Pre-sets onboarding flags to skip the multichain intro, predictions
GTM, and notifications prompts during automated vault initialization.
>
> - **Onboarding initialization
(`app/util/generateSkipOnboardingState.ts`)**:
> - Dispatches `setMultichainAccountsIntroModalSeen(true)` to skip the
multichain intro.
> - Sets storage flags to bypass modals:
> - `PREDICT_GTM_MODAL_SHOWN` → `TRUE` (skip predictions GTM modal)
> - `HAS_USER_TURNED_OFF_ONCE_NOTIFICATIONS` → `TRUE` (suppress enable
notifications prompt)
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
85b74a4. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
…#23938) ## **Description** This PR adds Mixpanel analytics tracking for Perps withdrawal transaction status changes. When a withdrawal transaction is confirmed as completed or failed via the HyperLiquid API a new event is pushed to Mixpanel. ## **Changelog** CHANGELOG entry: null ## **Related issues** Fixes: Jira Issue: https://consensyssoftware.atlassian.net/browse/TAT-2231 ## **Manual testing steps** ```gherkin Feature: Perps Withdrawal Analytics Tracking Scenario: user completes a withdrawal from Perps Given user has funds in their Perps account And user is on the Perps withdrawal screen When user initiates a withdrawal And the withdrawal is confirmed as completed via HyperLiquid API Then a PERPS_WITHDRAWAL_TRANSACTION event is tracked with status "completed" and the withdrawal amount ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** No Visible Change ### **After** No Visible Change ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Adds Mixpanel event tracking for Perps withdrawal transactions when confirmed completed or failed, including status and amount. > > - **Perps analytics**: > - In `PerpsController.updateWithdrawalStatus`, track `PERPS_WITHDRAWAL_TRANSACTION` via `MetaMetrics` when status changes to completed/failed, including `status` and numeric `withdrawalAmount`. > - Integrates `MetaMetricsEvents`, `MetricsEventBuilder`, and perps event constants for the new tracking. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit b565377. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** This PR updates the `BottomSheetHeader` to not have 16px vertical padding along with a 48px height constraint. <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: null ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/MDP-645 ## **Manual testing steps** ```gherkin Feature: my feature name Scenario: user [verb for user action] Given [describe expected initial app state] When user [verb for user action] Then [describe expected outcome] ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <img width="1290" height="141" alt="Simulator Screenshot - iPhone 15 Pro Max - 2025-12-15 at 16 13 33" src="https://github.com/user-attachments/assets/31c54778-859e-4d0a-aa9d-41ccf00d64ff" /> <!-- [screenshots/recordings] --> ### **After** <img width="1284" height="139" alt="Simulator Screenshot - iPhone 15 Pro Max - 2025-12-15 at 16 13 39" src="https://github.com/user-attachments/assets/a0e127f5-ae61-4bae-bc16-b752c5596348" /> <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Replaces `padding: 16` with `paddingHorizontal: 16` for `BottomSheetHeader`, removing vertical padding and updating snapshots accordingly. > > - **Component Library** > - `BottomSheetHeader.styles.ts`: replace `padding: 16` with `paddingHorizontal: 16` to remove vertical padding. > - **Tests/Snapshots** > - Update snapshots across multiple bottom sheet consumers to reflect `paddingHorizontal: 16` (some retaining explicit `paddingVertical: 0`). > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 14045f5. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: chore: Refine DeFi details spacing and avatar size ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/jira/software/c/projects/MDP/boards/2972?search=defi&selectedIssue=MDP-265 ## **Manual testing steps** ```gherkin Feature: my feature name Scenario: user [verb for user action] Given [describe expected initial app state] When user [verb for user action] Then [describe expected outcome] ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** ### **After** <img width="824" height="809" alt="Screenshot 2025-12-03 at 11 51 07 AM" src="https://github.com/user-attachments/assets/2f973cc6-0c2f-4c5d-82e2-e1c599d7c028" /> ## **Pre-merge author checklist** - [ ] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Increase DeFi position avatar to large and add vertical padding to details and separator wrappers. > > - **UI (DeFi Positions)**: > - **Avatar**: Increase `AvatarToken` size from `AvatarSize.Md` to `AvatarSize.Lg` in `DeFiAvatarWithBadge.tsx`. > - **Spacing**: > - Add `paddingTop: 8` to `detailsWrapper` in `DeFiProtocolPositionDetails.styles.ts`. > - Add `paddingVertical: 16` to `separatorWrapper` in `DeFiProtocolPositionDetails.styles.ts`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit d14427b. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: Prithpal Sooriya <prithpal.sooriya@consensys.net>
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** At larger text sizes, the asset details graph jumps because the price-diff text wraps. This PR prevents that text from scaling to keep the graph stable. ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: chore: Fix jumpy asset details graph ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/MDP-596?atlOrigin=eyJpIjoiYTFjNTM5NzNjNDVlNGUzNTlmYmZlMTBmMzIzY2JhMjIiLCJwIjoiaiJ9 ## **Manual testing steps** ```gherkin Feature: my feature name Scenario: user [verb for user action] Given [describe expected initial app state] When user [verb for user action] Then [describe expected outcome] ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** https://github.com/user-attachments/assets/a10fbcc0-c249-4d87-a0d4-b11c8efc5d92 ### **After** https://github.com/user-attachments/assets/bdee4ec3-c53c-437b-88f7-7581d4ca4dae ## **Pre-merge author checklist** - [ ] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Prevents font scaling and simplifies price-diff rendering (removing trend icon) to keep the asset chart layout stable. > > - **UI (Asset Overview Price)** > - Disable font scaling on price-diff and nested date label via `allowFontScaling={false}`. > - Simplify rendering: replace `priceDiffContainer` + Feather trend icon with inline `Text` showing diff, percentage, and date. > - Remove unused styles (`priceDiffContainer`, `priceDiffIcon`, `flexShrink`) and Feather icon import. > - Keep color logic in `styles.priceDiff`; update snapshots accordingly. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 162e4d5. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
## **Description** This PR makes a few improvements for Cursor Analysis: - Uses Opus 4.5 Thinking model for better results - Uses a persistent chat session with Cursor, adds the “Open in Cursor” and “Open in Web” links - Adds rating for each Cursor analysis comment ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: null ## **Related issues** Fixes: ## **Manual testing steps** ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Upgrade the issue-analysis workflow to use a persistent Cursor chat with the opus-4.5-thinking model, move the prompt to `.github/cursor/prompts`, and add “Open in Cursor/Web” links plus rating instructions to the posted comment. > > - **GitHub Actions workflow (`.github/workflows/cursor-issue-analysis.yml`)** > - Version bump to `0.3.0`. > - Use prompt from ``.github/cursor/prompts/issue-analysis.md`` (moved from ``.github/cursorPrompts/...``). > - Create persistent chat via `cursor-agent create-chat`, expose `chat_id`, and run analysis with `--resume` using `opus-4.5-thinking`. > - Enhance posted comment with direct links to open the chat in Cursor/Web and add a quick rating section. > - **Prompt templates** > - Add ``.github/cursor/prompts/issue-analysis.md`` defining analysis structure (problem, root cause, target repos, solutions, optional code diff). > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 147f09c. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Signed-off-by: dan437 <80175477+dan437@users.noreply.github.com>
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** After doing some profiling in the mobile app I found out we were making way too many calls to chains.json. Here are the scenarios where we were making the API calls: - When the app was unlocked and "All popular networks" selected -> 6 API calls - Whenever the network selector was opened -> 1 API call - Whenever "All popular networks" is selected from the network selector -> 6 API calls I have modified this to make a **single API call** whenever the main screen is mounted and use caching the rest of the times <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: reduce API calls to chains.json ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-2142 ## **Manual testing steps** ```gherkin Feature: my feature name Scenario: user [verb for user action] Given [describe expected initial app state] When user [verb for user action] Then [describe expected outcome] ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** https://github.com/user-attachments/assets/b68a7ef2-af6e-41b3-9db1-67730150200e <!-- [screenshots/recordings] --> ### **After** https://github.com/user-attachments/assets/c23ed561-19cb-4674-9a14-fda978674f68 <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Caches the chains list via a new useSafeChains hook (prefetched on Wallet mount), updates native token validation and RPC domain utilities to use the cache, and adjusts UI/typing/tests to reduce API calls and handle loading/errors. > > - **Hooks/Networking**: > - Add cached `useSafeChains` with in-memory promise + `SAFE_CHAINS_CACHE` storage; clear cache on failures to allow retries. > - Refactor `useIsOriginalNativeTokenSymbol` to use `useSafeChains`, return `null` while loading and `false` on error; remove direct axios calls. > - Change `SafeChain.chainId` to `number`; export `resetChainsListCache` for tests. > - **UI**: > - `Wallet`: call `useSafeChains()` on mount to prefetch chains list. > - `ScamWarningIcon`: only show warning when validation is explicitly `false`; unchanged when `null` (loading). > - `NetworkModal`: consume `SafeChain`/`rpcIdentifierUtility` from `useSafeChains` and remove local `SafeChain` type. > - **Utils**: > - `rpc-domain-utils`: use `SafeChain` from `useSafeChains`; initialize known domains from cached chains; robust domain parsing/validation retained. > - **Tests**: > - Update tests to mock `useSafeChains`, new loading/null behavior, numeric `chainId`, and cache reset; expand coverage for retries and invalid data handling. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 1cfbe75. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )